Public Class DataError
    Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

    Public Sub New()
        MyBase.New()

        'This call is required by the Windows Form Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call

    End Sub

    'Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.  
    'Do not modify it using the code editor.
    Friend WithEvents btnOk As System.Windows.Forms.Button
    Friend WithEvents picError As System.Windows.Forms.PictureBox
    Friend WithEvents lblError As System.Windows.Forms.Label
    Friend WithEvents txtError As System.Windows.Forms.TextBox
    Friend WithEvents btnDetails As System.Windows.Forms.Button
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(DataError))
        Me.picError = New System.Windows.Forms.PictureBox
        Me.lblError = New System.Windows.Forms.Label
        Me.btnDetails = New System.Windows.Forms.Button
        Me.btnOk = New System.Windows.Forms.Button
        Me.txtError = New System.Windows.Forms.TextBox
        Me.SuspendLayout()
        '
        'picError
        '
        Me.picError.AccessibleDescription = resources.GetString("picError.AccessibleDescription")
        Me.picError.AccessibleName = resources.GetString("picError.AccessibleName")
        Me.picError.Anchor = CType(resources.GetObject("picError.Anchor"), System.Windows.Forms.AnchorStyles)
        Me.picError.BackgroundImage = CType(resources.GetObject("picError.BackgroundImage"), System.Drawing.Image)
        Me.picError.Dock = CType(resources.GetObject("picError.Dock"), System.Windows.Forms.DockStyle)
        Me.picError.Enabled = CType(resources.GetObject("picError.Enabled"), Boolean)
        Me.picError.Font = CType(resources.GetObject("picError.Font"), System.Drawing.Font)
        Me.picError.Image = CType(resources.GetObject("picError.Image"), System.Drawing.Image)
        Me.picError.ImeMode = CType(resources.GetObject("picError.ImeMode"), System.Windows.Forms.ImeMode)
        Me.picError.Location = CType(resources.GetObject("picError.Location"), System.Drawing.Point)
        Me.picError.Name = "picError"
        Me.picError.RightToLeft = CType(resources.GetObject("picError.RightToLeft"), System.Windows.Forms.RightToLeft)
        Me.picError.Size = CType(resources.GetObject("picError.Size"), System.Drawing.Size)
        Me.picError.SizeMode = CType(resources.GetObject("picError.SizeMode"), System.Windows.Forms.PictureBoxSizeMode)
        Me.picError.TabIndex = CType(resources.GetObject("picError.TabIndex"), Integer)
        Me.picError.TabStop = False
        Me.picError.Text = resources.GetString("picError.Text")
        Me.picError.Visible = CType(resources.GetObject("picError.Visible"), Boolean)
        '
        'lblError
        '
        Me.lblError.AccessibleDescription = resources.GetString("lblError.AccessibleDescription")
        Me.lblError.AccessibleName = resources.GetString("lblError.AccessibleName")
        Me.lblError.Anchor = CType(resources.GetObject("lblError.Anchor"), System.Windows.Forms.AnchorStyles)
        Me.lblError.AutoSize = CType(resources.GetObject("lblError.AutoSize"), Boolean)
        Me.lblError.Dock = CType(resources.GetObject("lblError.Dock"), System.Windows.Forms.DockStyle)
        Me.lblError.Enabled = CType(resources.GetObject("lblError.Enabled"), Boolean)
        Me.lblError.Font = CType(resources.GetObject("lblError.Font"), System.Drawing.Font)
        Me.lblError.Image = CType(resources.GetObject("lblError.Image"), System.Drawing.Image)
        Me.lblError.ImageAlign = CType(resources.GetObject("lblError.ImageAlign"), System.Drawing.ContentAlignment)
        Me.lblError.ImageIndex = CType(resources.GetObject("lblError.ImageIndex"), Integer)
        Me.lblError.ImeMode = CType(resources.GetObject("lblError.ImeMode"), System.Windows.Forms.ImeMode)
        Me.lblError.Location = CType(resources.GetObject("lblError.Location"), System.Drawing.Point)
        Me.lblError.Name = "lblError"
        Me.lblError.RightToLeft = CType(resources.GetObject("lblError.RightToLeft"), System.Windows.Forms.RightToLeft)
        Me.lblError.Size = CType(resources.GetObject("lblError.Size"), System.Drawing.Size)
        Me.lblError.TabIndex = CType(resources.GetObject("lblError.TabIndex"), Integer)
        Me.lblError.Text = resources.GetString("lblError.Text")
        Me.lblError.TextAlign = CType(resources.GetObject("lblError.TextAlign"), System.Drawing.ContentAlignment)
        Me.lblError.Visible = CType(resources.GetObject("lblError.Visible"), Boolean)
        '
        'btnDetails
        '
        Me.btnDetails.AccessibleDescription = resources.GetString("btnDetails.AccessibleDescription")
        Me.btnDetails.AccessibleName = resources.GetString("btnDetails.AccessibleName")
        Me.btnDetails.Anchor = CType(resources.GetObject("btnDetails.Anchor"), System.Windows.Forms.AnchorStyles)
        Me.btnDetails.BackgroundImage = CType(resources.GetObject("btnDetails.BackgroundImage"), System.Drawing.Image)
        Me.btnDetails.Dock = CType(resources.GetObject("btnDetails.Dock"), System.Windows.Forms.DockStyle)
        Me.btnDetails.Enabled = CType(resources.GetObject("btnDetails.Enabled"), Boolean)
        Me.btnDetails.FlatStyle = CType(resources.GetObject("btnDetails.FlatStyle"), System.Windows.Forms.FlatStyle)
        Me.btnDetails.Font = CType(resources.GetObject("btnDetails.Font"), System.Drawing.Font)
        Me.btnDetails.Image = CType(resources.GetObject("btnDetails.Image"), System.Drawing.Image)
        Me.btnDetails.ImageAlign = CType(resources.GetObject("btnDetails.ImageAlign"), System.Drawing.ContentAlignment)
        Me.btnDetails.ImageIndex = CType(resources.GetObject("btnDetails.ImageIndex"), Integer)
        Me.btnDetails.ImeMode = CType(resources.GetObject("btnDetails.ImeMode"), System.Windows.Forms.ImeMode)
        Me.btnDetails.Location = CType(resources.GetObject("btnDetails.Location"), System.Drawing.Point)
        Me.btnDetails.Name = "btnDetails"
        Me.btnDetails.RightToLeft = CType(resources.GetObject("btnDetails.RightToLeft"), System.Windows.Forms.RightToLeft)
        Me.btnDetails.Size = CType(resources.GetObject("btnDetails.Size"), System.Drawing.Size)
        Me.btnDetails.TabIndex = CType(resources.GetObject("btnDetails.TabIndex"), Integer)
        Me.btnDetails.Text = resources.GetString("btnDetails.Text")
        Me.btnDetails.TextAlign = CType(resources.GetObject("btnDetails.TextAlign"), System.Drawing.ContentAlignment)
        Me.btnDetails.Visible = CType(resources.GetObject("btnDetails.Visible"), Boolean)
        '
        'btnOk
        '
        Me.btnOk.AccessibleDescription = resources.GetString("btnOk.AccessibleDescription")
        Me.btnOk.AccessibleName = resources.GetString("btnOk.AccessibleName")
        Me.btnOk.Anchor = CType(resources.GetObject("btnOk.Anchor"), System.Windows.Forms.AnchorStyles)
        Me.btnOk.BackgroundImage = CType(resources.GetObject("btnOk.BackgroundImage"), System.Drawing.Image)
        Me.btnOk.DialogResult = System.Windows.Forms.DialogResult.OK
        Me.btnOk.Dock = CType(resources.GetObject("btnOk.Dock"), System.Windows.Forms.DockStyle)
        Me.btnOk.Enabled = CType(resources.GetObject("btnOk.Enabled"), Boolean)
        Me.btnOk.FlatStyle = CType(resources.GetObject("btnOk.FlatStyle"), System.Windows.Forms.FlatStyle)
        Me.btnOk.Font = CType(resources.GetObject("btnOk.Font"), System.Drawing.Font)
        Me.btnOk.Image = CType(resources.GetObject("btnOk.Image"), System.Drawing.Image)
        Me.btnOk.ImageAlign = CType(resources.GetObject("btnOk.ImageAlign"), System.Drawing.ContentAlignment)
        Me.btnOk.ImageIndex = CType(resources.GetObject("btnOk.ImageIndex"), Integer)
        Me.btnOk.ImeMode = CType(resources.GetObject("btnOk.ImeMode"), System.Windows.Forms.ImeMode)
        Me.btnOk.Location = CType(resources.GetObject("btnOk.Location"), System.Drawing.Point)
        Me.btnOk.Name = "btnOk"
        Me.btnOk.RightToLeft = CType(resources.GetObject("btnOk.RightToLeft"), System.Windows.Forms.RightToLeft)
        Me.btnOk.Size = CType(resources.GetObject("btnOk.Size"), System.Drawing.Size)
        Me.btnOk.TabIndex = CType(resources.GetObject("btnOk.TabIndex"), Integer)
        Me.btnOk.Text = resources.GetString("btnOk.Text")
        Me.btnOk.TextAlign = CType(resources.GetObject("btnOk.TextAlign"), System.Drawing.ContentAlignment)
        Me.btnOk.Visible = CType(resources.GetObject("btnOk.Visible"), Boolean)
        '
        'txtError
        '
        Me.txtError.AccessibleDescription = resources.GetString("txtError.AccessibleDescription")
        Me.txtError.AccessibleName = resources.GetString("txtError.AccessibleName")
        Me.txtError.Anchor = CType(resources.GetObject("txtError.Anchor"), System.Windows.Forms.AnchorStyles)
        Me.txtError.AutoSize = CType(resources.GetObject("txtError.AutoSize"), Boolean)
        Me.txtError.BackgroundImage = CType(resources.GetObject("txtError.BackgroundImage"), System.Drawing.Image)
        Me.txtError.Dock = CType(resources.GetObject("txtError.Dock"), System.Windows.Forms.DockStyle)
        Me.txtError.Enabled = CType(resources.GetObject("txtError.Enabled"), Boolean)
        Me.txtError.Font = CType(resources.GetObject("txtError.Font"), System.Drawing.Font)
        Me.txtError.ImeMode = CType(resources.GetObject("txtError.ImeMode"), System.Windows.Forms.ImeMode)
        Me.txtError.Location = CType(resources.GetObject("txtError.Location"), System.Drawing.Point)
        Me.txtError.MaxLength = CType(resources.GetObject("txtError.MaxLength"), Integer)
        Me.txtError.Multiline = CType(resources.GetObject("txtError.Multiline"), Boolean)
        Me.txtError.Name = "txtError"
        Me.txtError.PasswordChar = CType(resources.GetObject("txtError.PasswordChar"), Char)
        Me.txtError.ReadOnly = True
        Me.txtError.RightToLeft = CType(resources.GetObject("txtError.RightToLeft"), System.Windows.Forms.RightToLeft)
        Me.txtError.ScrollBars = CType(resources.GetObject("txtError.ScrollBars"), System.Windows.Forms.ScrollBars)
        Me.txtError.Size = CType(resources.GetObject("txtError.Size"), System.Drawing.Size)
        Me.txtError.TabIndex = CType(resources.GetObject("txtError.TabIndex"), Integer)
        Me.txtError.Text = resources.GetString("txtError.Text")
        Me.txtError.TextAlign = CType(resources.GetObject("txtError.TextAlign"), System.Windows.Forms.HorizontalAlignment)
        Me.txtError.Visible = CType(resources.GetObject("txtError.Visible"), Boolean)
        Me.txtError.WordWrap = CType(resources.GetObject("txtError.WordWrap"), Boolean)
        '
        'DataError
        '
        Me.AcceptButton = Me.btnOk
        Me.AccessibleDescription = resources.GetString("$this.AccessibleDescription")
        Me.AccessibleName = resources.GetString("$this.AccessibleName")
        Me.AutoScaleBaseSize = CType(resources.GetObject("$this.AutoScaleBaseSize"), System.Drawing.Size)
        Me.AutoScroll = CType(resources.GetObject("$this.AutoScroll"), Boolean)
        Me.AutoScrollMargin = CType(resources.GetObject("$this.AutoScrollMargin"), System.Drawing.Size)
        Me.AutoScrollMinSize = CType(resources.GetObject("$this.AutoScrollMinSize"), System.Drawing.Size)
        Me.BackgroundImage = CType(resources.GetObject("$this.BackgroundImage"), System.Drawing.Image)
        Me.CancelButton = Me.btnOk
        Me.ClientSize = CType(resources.GetObject("$this.ClientSize"), System.Drawing.Size)
        Me.Controls.Add(Me.btnOk)
        Me.Controls.Add(Me.btnDetails)
        Me.Controls.Add(Me.txtError)
        Me.Controls.Add(Me.lblError)
        Me.Controls.Add(Me.picError)
        Me.Enabled = CType(resources.GetObject("$this.Enabled"), Boolean)
        Me.Font = CType(resources.GetObject("$this.Font"), System.Drawing.Font)
        Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog
        Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
        Me.ImeMode = CType(resources.GetObject("$this.ImeMode"), System.Windows.Forms.ImeMode)
        Me.Location = CType(resources.GetObject("$this.Location"), System.Drawing.Point)
        Me.MaximizeBox = False
        Me.MaximumSize = CType(resources.GetObject("$this.MaximumSize"), System.Drawing.Size)
        Me.MinimizeBox = False
        Me.MinimumSize = CType(resources.GetObject("$this.MinimumSize"), System.Drawing.Size)
        Me.Name = "DataError"
        Me.RightToLeft = CType(resources.GetObject("$this.RightToLeft"), System.Windows.Forms.RightToLeft)
        Me.ShowInTaskbar = False
        Me.StartPosition = CType(resources.GetObject("$this.StartPosition"), System.Windows.Forms.FormStartPosition)
        Me.Text = resources.GetString("$this.Text")
        Me.ResumeLayout(False)

    End Sub

#End Region

    Private Sub btnDetail_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDetails.Click
        Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager("Avand.strings", GetType(Avand.[Global]).Assembly)
        '------------------
        If txtError.Visible Then
            btnDetails.Text = resources.GetString("FormView.ShowDetails") & " >>"
            txtError.Visible = False
            Height = 136
        Else
            btnDetails.Text = resources.GetString("FormView.HideDetails") & " <<"
            txtError.Visible = True
            Height = 240
        End If
        '------------------
        resources = Nothing
    End Sub
    Public Sub New(ByVal ex As Exception, ByVal ico As MessageBoxIcon)
        MyBase.New()
        InitializeComponent()

        Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager("Avand.strings", GetType(Avand.[Global]).Assembly)
        '------------------
        Select Case ico
            Case MessageBoxIcon.Exclamation
                picError.Image = SystemIcons.Exclamation.ToBitmap
                Text = resources.GetString("FormView.ErrorTitle1")
                lblError.Text = resources.GetString("FormView.ErrorContent1")
            Case MessageBoxIcon.Error
                picError.Image = SystemIcons.Error.ToBitmap
                Text = resources.GetString("FormView.ErrorTitle2")
                lblError.Text = resources.GetString("FormView.ErrorContent2")
        End Select
        btnDetails.Text = resources.GetString("FormView.ShowDetails") & " >>"
        txtError.Text = ex.Message
        '------------------
        resources = Nothing
    End Sub
    Public Shared Sub ShowError(ByVal ex As Exception, ByVal ico As MessageBoxIcon)
        Dim dError As New Avand.DataError(ex, ico)
        dError.ShowDialog()
        dError.Close() : dError = Nothing
    End Sub
End Class
